package action.chap3.method;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

public class Demo {
    public static void main(String[] args) {
        Student student1 = new Student("zhangsan",60);
        Student student2 = new Student("lisi",70);
        Student student3 = new Student("wangwu",80);
        Student student4 = new Student("zhaoliu",90);
        Student student5 = new Student("zhaoliu",80);
        List<Student> students = Arrays.asList(student1,student2,student3,student4,student5);
        //students.sort(Student::compareStudentByScore);
        //比较器链  逆序
        students.sort(Comparator.comparingInt(Student::getScore).reversed().thenComparing(Student::getName));
        students.forEach(System.out::println);



    }
}
